package com.github.od.util.jwt;

import java.io.Serializable;

import com.github.od.util.jwt.IJWTInfo;

/**
 * JWT封装类
 * 
 * @author xieweikun
 * @version 2017年11月16日 下午2:21:30
 */
public class JWTInfo implements Serializable,IJWTInfo {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2811966946873379920L;
	private String userId;
	private String userName;
	private String name;

	public JWTInfo(String userId, String userName, String name) {
		super();
		this.userId = userId;
		this.userName = userName;
		this.name = name;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((userId == null) ? 0 : userId.hashCode());
		result = prime * result + ((userName == null) ? 0 : userName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		JWTInfo other = (JWTInfo) obj;
		if (userId == null) {
			if (other.userId != null)
				return false;
		} else if (!userId.equals(other.userId))
			return false;
		if (userName == null) {
			if (other.userName != null)
				return false;
		} else if (!userName.equals(other.userName))
			return false;
		return true;
	}

	@Override
	public String getId() {
		return userId;
	}

	@Override
	public String getUniqueName() {
		return userName;
	}

}
